package com.bj.disc.service

import android.app.Service
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.IBinder
import com.ai3d.rfid.common.event.EventMgs
import com.ym521.logdog.LogDog

/**
 * @ProjectName : disc
 * @Author : weijinsong
 * @Time : 2023/7/15 10:38
 * @Description : 文件描述
 */
class UploadEventsService : Service() {
    var logTag = UploadEventsService::class.java.simpleName
    companion object {
        fun startUploadEventsService(context: Context) {
            val intent = Intent(context, UploadEventsService::class.java)
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                context.startForegroundService(intent);
            } else {
                context.startService(intent);
            }
        }
    }

    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        LogDog.debug(logTag,"启动上报事件服务")
        EventMgs.realEventReport()
        return super.onStartCommand(intent, flags, startId)
    }



    override fun onDestroy() {
        super.onDestroy()
    }

    override fun onBind(p0: Intent?): IBinder? {
        TODO("Not yet implemented")
    }
}